home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 April / macformat-023.iso / Shareware City / Developers / NeoPersist 3.0.8 folder / NeoIncludes / CNeoStream.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-31  |  5.4 KB  |  119 lines  |  [TEXT/MMCC]

  1.  /************************************************************
  2.  *
  3.  *    Created: Wednesday, November 24, 1993 19:25:00
  4.  *
  5.  *    CNeoStream.h
  6.  *
  7.  *    C++ class implementation for NeoAccess abstract stream class
  8.  *
  9.  *    Most C++ compilers include a standard set of classes which
  10.  *    implement an input/output facility which is referred to as
  11.  *    a stream. The most common stream class supports the
  12.  *    transfer of basic C data types such as integers, floating-
  13.  *    point numbers and character strings to and from a database.
  14.  *
  15.  *    While streams have been around for some time, our
  16.  *    understanding of them continues to evolve. We know, for
  17.  *    example, that we need different types of streams for
  18.  *    different purposes. Application-specific environments may
  19.  *    benefit from the use of a stream subclass which also
  20.  *    supports application-specific data types, an imaginary
  21.  *    number for instance. Other environments may find useful a
  22.  *    stream that transfers data not to a database but across a
  23.  *    network pipe or an interprocess communications channel. As
  24.  *    you can see from these two examples, there are two
  25.  *    directions in which stream derivations can occur. One
  26.  *    direction addresses the type of data being accessed. The
  27.  *    other defines the source/destination of the data.
  28.  *
  29.  *    NeoAccess  releases 2.2 and later use a construct called a
  30.  *    stream to address the issue of where data is coming from or
  31.  *    going to. The abstract base class CNeoStream provides an
  32.  *    interface through which basic data types can be read in or
  33.  *    written out. This base class is subclassed to build a stream
  34.  *    class, CNeoFileStream, for reading from and writing to a
  35.  *    file.
  36.  *
  37.  *    The NeoAccess database class, CNeoDatabase, provides an extremely
  38.  *    powerful mechanism for accessing persistent objects. These
  39.  *    objects use persistence properties provided by their base
  40.  *    class, CNeoPersist. And together these three base classes -
  41.  *    CNeoStream, CNeoDatabase and CNeoPersist - create an incredibly
  42.  *    powerful and high performance database engine which is both
  43.  *    extensible and easy to use.
  44.  *
  45.  *    Copyright © Neologic Systems 1992-1994. All Rights Reserved.
  46.  *    All rights reserved
  47.  *
  48.  *
  49.  ***********************************************************/
  50. #pragma once            /* Include this file only once */
  51. #ifndef __CNeoStream__
  52. #define __CNeoStream__ 1
  53.  
  54. #include "NeoTypes.h"
  55.  
  56. class CNeoPerist;
  57.  
  58. class CNeoStream
  59. {
  60. public:
  61.                         /** Instance Methods **/
  62.                         CNeoStream(void);
  63.     virtual                ~CNeoStream(void);
  64.  
  65.                         /** Access Methods **/
  66.     virtual void        close(void);
  67.     virtual void        flush(const Boolean aEntireStream = FALSE);
  68.     virtual OSType        getCreator(void) const;
  69.     virtual long        getLength(void) const;
  70.     virtual NeoMark        getMark(void) const;
  71.     virtual OSType        getStreamType(void) const = 0;
  72.     virtual OSType        getType(void) const;
  73.     virtual Boolean        isOpen(void) const;
  74.     virtual void        setCreator(const OSType aCreator);
  75.     virtual void        setLength(const long aLength, const Boolean aReallySet = FALSE);
  76.     virtual void        setMark(const NeoMark aMark);
  77.     virtual void        setType(const OSType aType);
  78.  
  79.                         /** Structuring Methods **/
  80.     virtual void        closeList(void);
  81.     virtual void        openList(const NeoTag aTag = kNeoNoTag);
  82.  
  83.                         /** I/O Methods **/
  84.     virtual void        readBits(void *aBits, const short aCount, const NeoTag aTag = kNeoNoTag);
  85.     virtual NeoBlob        readBlob(const NeoMark aMark, long &aLength, const NeoTag aTag = kNeoNoTag);
  86.     virtual char        readChar(const NeoTag aTag = kNeoNoTag);
  87.     virtual void        readChunk(void *aBuffer, const long aLength, const NeoTag aTag = kNeoNoTag) = 0;
  88.     virtual NeoFloat    readFloat(const NeoTag aTag = kNeoNoTag);
  89.     virtual NeoDouble    readDouble(const NeoTag aTag = kNeoNoTag);
  90.     virtual NeoLongDouble
  91.                         readLongDouble(const NeoTag aTag = kNeoNoTag);
  92.     virtual long        readLong(const NeoTag aTag = kNeoNoTag);
  93.     virtual Boolean        readBoolean(const NeoTag aTag = kNeoNoTag);
  94.     virtual void        readNativeString(CNeoString &aString, const long aMaxLength = 0, const NeoTag aTag = kNeoNoTag);
  95.     virtual void        readObject(CNeoPersist *aObject, const NeoTag aTag = kNeoNoTag);
  96.     virtual short        readShort(const NeoTag aTag = kNeoNoTag);
  97.     virtual void        readString(void *aBuffer, const long aLength, const NeoTag aTag = kNeoNoTag);
  98.  
  99.     virtual void        writeBits(const void *aBits, const short aCount, const NeoTag aTag = kNeoNoTag);
  100.     virtual void        writeBlob(NeoBlob aBlob, const NeoMark aMark, const long aLength, const NeoTag aTag = kNeoNoTag);
  101.     virtual void        writeChar(const char aValue, const NeoTag aTag = kNeoNoTag);
  102.     virtual void        writeChunk(const void *aBuffer, const long aLength, const NeoTag aTag = kNeoNoTag) = 0;
  103.     virtual void        writeFloat(const NeoFloat &aValue, const NeoTag aTag = kNeoNoTag);
  104.     virtual void        writeDouble(const NeoDouble &aValue, const NeoTag aTag = kNeoNoTag);
  105.     virtual void        writeLongDouble(const NeoLongDouble &aValue, const NeoTag aTag = kNeoNoTag);
  106.     virtual void        writeLong(const long aValue, const NeoTag aTag = kNeoNoTag);
  107.     virtual void        writeBoolean(const Boolean aBool, const NeoTag aTag = kNeoNoTag);
  108.     virtual void        writeNativeString(const CNeoString &aString, const long aMaxLength, const NeoTag aTag = kNeoNoTag);
  109.     virtual void        writeObject(CNeoPersist *aObject, const NeoTag aTag = kNeoNoTag);
  110.     virtual void        writeShort(const short aValue, const NeoTag aTag = kNeoNoTag);
  111.     virtual void        writeString(const void *aString, const long aMaxLength, const NeoTag aTag = kNeoNoTag);
  112.  
  113.                         /*** Instance Variables ***/
  114.     NeoMark                fMark;                // current mark for this database
  115.     long                fLength;            // length of stream
  116. };
  117.  
  118. #endif
  119.